import { AuthorityRouter } from "@/types/idm/user";
import { appExternalRoutes, appRoutes, customizedExternalRoutes } from "../routes";

// const mixinRoutes = [...appRoutes, ...appExternalRoutes, ...customizedExternalRoutes];

export default function appClientMenus(
  menuFromServer: boolean,
  appAsyncMenus: AuthorityRouter[]
) {
  const rs = [];
  if (menuFromServer) {
    rs.push(...appAsyncMenus);
  } else {
    rs.push(...appRoutes);
    rs.push(...appExternalRoutes);
    rs.push(...customizedExternalRoutes);
  }
  const allRoutes = rs.map((el) => {
    const { name, path, meta, redirect, children } = el;
    return {
      name,
      path,
      meta,
      redirect,
      children
    };
  });
  console.log("allRoutes:", allRoutes);
  return allRoutes;
}
